#include "stdio.h"
#include "stdlib.h"
typedef unsigned char *byte_pointer;
typedef unsigned int uint;

int x_combine_y(int x, int y)
{
    printf("x == %x\r\ny == %x\r\n",x,y);

    return (x & 0xff) | (y & 0xffffff00);
}
unsigned replace_byte(unsigned source, unsigned char replacement, int position)
{
    if((0 <= position) && (3 >= position))
    {
        source = source &~(0xff << (8 * position)) | (replacement << (8 * position));
    }
    return source;


}

void main(int argc, char *argv[])
{
    int result;
    if(argc == 4)
        result = replace_byte(atoi(argv[1]),atoi(argv[2]),atoi(argv[3]));
    else
        printf("Need more argument!\r\n");
    printf("replace_byte(%x, %x, %d) -->  %x\r\n",atoi(argv[1]),atoi(argv[2]),atoi(argv[3]),result);
}
